<?php
// +----------------------------------------------------------------------
// | 重点客户抓取
// +----------------------------------------------------------------------

namespace app\admin\controller\v2;
use app\admin\Adminbase;
use base\files\Poster;
use app\admin\model\SystemParamValue;

// namespace app\admin\controller\v2;
// use app\admin\Adminbase;
// use base\files\Poster;
// use app\admin\model\SystemParamValue;

class KeyChase extends Adminbase{


	/**
	 * 重点客户抓取信息存储
	*/
	public function set($shop_id, $data){
		try{
			$res = model("admin/system_param_value")
				->where('param_code', 'buess_shop_khfx_zdkhzq')
				->where('parent_value', $shop_id)
				->delete();
			
			$res = model("admin/system_param_value")->save([
					'param_scope'=>'店铺参数',
					'param_code'=>'buess_shop_khfx_zdkhzq',
					'parent_value'=>$shop_id,
					'param_value'=>$data
				]);
			return $this->reSucess(true);
		}catch(\Exception $e){
			return $this->ReError($e->getMessage());
		}
	}

	/**
	 * 获取重点客户抓取信息
	*/
	public function get($shop_id){
		try{
			$result = model("admin/system_param_value")
				->where('param_code', 'buess_shop_khfx_zdkhzq')
				->where('parent_value', $shop_id)
				->value('param_value')?? '';
			return $this->reSucess($result);
		}catch(\Exception $e){
			return $this->ReError($e->getMessage());
		}
	}
}